<?php
/**
 * Created by PhpStorm.
 * User: wjj
 * Date: 2016/11/1
 */

namespace app\logic;

use app\models\Adv;
use app\models\Area;

class CommonLogic
{
    public function getArea($parent_code,$level){
        return Area::find()->where(['parent_code'=>$parent_code,'region_level'=>$level])->asArray()->all();
    }

    public function getAdv(){
        $time = date('Y-m-d H:i:s');
        return Adv::find()->select('adv_title,adv_pic,adv_link')->where(['<=','start_time',$time])->andWhere(['>=','end_time',$time])->andWhere(['adv_status'=>1])->orderBy('adv_sort asc')->asArray()->all();
    }

}
